package com.cgsd.heyu.ui.task.adapter;

import android.text.Html;

import com.cgsd.heyu.R;
import com.cgsd.heyu.common.AvatarManger;
import com.cgsd.heyu.ui.task.vo.TaskListVo;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

/**
 * Author: sky on 2021/3/2 10:46
 * Email: xcode126@126.com
 * Desc: 任务大厅
 */
public class TaskChildAdapter extends BaseQuickAdapter<TaskListVo.TasklistBean, BaseViewHolder> {

    public TaskChildAdapter() {
        super(R.layout.item_task_child);
    }

    @Override
    protected void convert(BaseViewHolder helper, TaskListVo.TasklistBean item) {
//        helper.addOnClickListener(R.id.tv_booking);
        AvatarManger.setAvatar(mContext, item.userImg, helper.getView(R.id.iv_bg));
        helper.setText(R.id.tv_name, item.title);
        helper.setText(R.id.tv_complete, Html.fromHtml(String.format("%1$s<font color='#E94E4E'>%2$s</font>", mContext.getString(R.string.a_complete), item.tnum)));
        helper.setText(R.id.tv_last, Html.fromHtml(String.format("%1$s<font color='#E94E4E'>%2$s</font>", mContext.getString(R.string.a_last), (item.num - item.tnum))));
        helper.setText(R.id.tv_v, String.format("%1$s%2$.2f%3$s", "V：", item.price, mContext.getString(R.string.a_unit_yuan)));//VIP价格
        helper.setText(R.id.tv_reward, String.format("%1$s%2$.2f%3$s", mContext.getString(R.string.a_reward_), item.price1, mContext.getString(R.string.a_unit_yuan)));//普通价格
        helper.setText(R.id.tv_commit, Html.fromHtml(String.format("%1$s<font color='#666666'>%2$s%3$s</font>", mContext.getString(R.string.a_commit_), item.finish, mContext.getString(R.string.a_unit_hour))));
        helper.setText(R.id.tv_number, Html.fromHtml(String.format("%1$s<font color='#666666'>#%2$s</font>", mContext.getString(R.string.a_number_), item.code)));
        helper.setText(R.id.tv_end_time, Html.fromHtml(String.format("%1$s<font color='#666666'>%2$s</font>", mContext.getString(R.string.a_end_time_), item.endtime)));
        helper.setText(R.id.tv_label1,"标签一");
        helper.setText(R.id.tv_label2,"标签二");
    }
}
